home *** CD-ROM | disk | FTP | other *** search
- property UpCM, DownCM, button_active, whichevent, whichLabel
-
- on getPropertyDescriptionList
- set description to [:]
- if the currentSpriteNum = 0 then
- set memdefault to 0
- else
- set memref to the member of sprite the currentSpriteNum
- set castLibNum to the castLibNum of memref
- set memdefault to member (the memberNum of member memref + 1) of castLib castLibNum
- end if
- addProp(description, #DownCM, [#default: memdefault, #format: #bitmap, #comment: "Pict for Down:"])
- addProp(description, #whichevent, [#default: #mouseUp, #format: #symbol, #comment: "Go To Marker On Which Event:", #range: [#mouseUp, #mouseDown, #mouseEnter, #mouseLeave, #mouseUpOutSide]])
- addProp(description, #whichLabel, [#default: EMPTY, #format: #marker, #comment: "Goto which marker label:"])
- return description
- end
-
- on getBehaviorDescription
- return "Button, auto set up pict, switch pict down, go to a specified label on user defined event"
- end
-
- on getAssocMembers
- set myPropList to [DownCM]
- return myPropList
- end
-
- on beginSprite me
- set the UpCM of me to the member of sprite the spriteNum of me
- set the button_active of me to 0
- puppetSprite(the spriteNum of me, 1)
- end
-
- on endSprite me
- puppetSprite(the spriteNum of me, 0)
- end
-
- on do_it me
- go(label(the whichLabel of me))
- end
-
- on mouseDown me
- set the member of sprite the spriteNum of me to member the DownCM of me
- set the button_active of me to 1
- if the whichevent of me = #mouseDown then
- do_it(me)
- end if
- end
-
- on mouseUp me
- set the member of sprite the spriteNum of me to member the UpCM of me
- set the button_active of me to 0
- if the whichevent of me = #mouseUp then
- do_it(me)
- end if
- end
-
- on mouseUpOutSide me
- set the button_active of me to 0
- if the whichevent of me = #mouseUpOutSide then
- do_it(me)
- end if
- end
-
- on mouseLeave me
- if the button_active of me then
- set the member of sprite the spriteNum of me to member the UpCM of me
- end if
- if the whichevent of me = #mouseLeave then
- do_it(me)
- end if
- end
-
- on mouseEnter me
- if the button_active of me then
- set the member of sprite the spriteNum of me to member the DownCM of me
- end if
- if the whichevent of me = #mouseEnter then
- do_it(me)
- end if
- end
-